package com.hanyi.mvc.contorller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@Controller
public class ParamContorller {
    @RequestMapping("request")
    public String request(HttpServletRequest request){
        request.setAttribute("name","hanyi");
        return "param";
    }

    @RequestMapping("model")
    public String modle(Model model){
        model.addAttribute("name","model");
        return "param";
    }

    @RequestMapping("modelAndView")
    public ModelAndView modelAndView(ModelAndView modelAndView){
        modelAndView.addObject("name","modelAndView");
        modelAndView.setViewName("param");
        return modelAndView;
    }
}
